package edu.ucuenca.tc.listenandtouch;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;

public class AdaptadorAnimalModo1 extends BaseAdapter{
	private Context mContext;

    public AdaptadorAnimalModo1(Context c) {
        mContext = c;
    }

    public int getCount() {
        return mThumbIds.length;
    }

    public Object getItem(int position) {
        return null;
    }

    public long getItemId(int position) {
        return 0;
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        ImageView imageView;
        if (convertView == null) {  // if it's not recycled, initialize some attributes
            imageView = new ImageView(mContext);
            imageView.setLayoutParams(new GridView.LayoutParams(85, 85));
            imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
            imageView.setPadding(8, 8, 8, 8);
        } else {
            imageView = (ImageView) convertView;
        }

        imageView.setImageResource(mThumbIds[position]);
        return imageView;
    }

    private Integer[] mThumbIds = {
            R.drawable.burro, R.drawable.caballo, 
            R.drawable.cerdo, R.drawable.elefante, 
            R.drawable.gallina, R.drawable.gallo, 
            R.drawable.gato, R.drawable.leon, 
            R.drawable.lobo, R.drawable.mono, 
            R.drawable.mosco, R.drawable.oveja, 
            R.drawable.pajaro, R.drawable.pato, 
            R.drawable.perro, R.drawable.pollo, 
            R.drawable.rana, R.drawable.tigre, 
    };

}
